package com.lhys.mapper;

import com.lhys.pojo.AssetGainMode;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 取得方式表 Mapper 接口
 * </p>
 *
 * @author 小七
 * @since 2021-05-06
 */
public interface AssetGainModeMapper {
    //查询取得方式列表
    @Select("select * from asset_gain_mode")
    List<AssetGainMode> getAssetGainModeList();

    //根据名称或说明查询
    List<AssetGainMode> getAssetGainModeByCodeAndTitleOrRemarkList(AssetGainMode assetGainMode);

    //根据id查询
    @Select("select * from asset_gain_mode where id = #{id}")
    AssetGainMode getAssetGainModeById(Integer id);

    //根据用户id查询
    @Select("select * from asset_gain_mode where assetUserId = #{assetUserId}")
    AssetGainMode getAssetGainModeByAssetUserId(Integer assetUserId);

    //根据编码查询
    @Select("select * from asset_gain_mode where code = #{code}")
    AssetGainMode getAssetGainModeByCode(String code);

    //新增取得方式
    @Insert("insert into asset_gain_mode(asset_user_id, title, code, status,remark, create_time) VALUES (#{assetUserId}, #{title}, #{code}, #{status}, #{remark}, #{createTime})")
    Integer addAssetGainMode(AssetGainMode assetGainMode);

    //删除取得方式
    @Delete("delete from asset_gain_mode where id = #{id}")
    Integer delAssetGainMode(Integer id);

    //修改取得方式
    Integer updateAssetGainMode(AssetGainMode assetGainMode);

}
